package cn.yuan.xiaoyu.newsmodule.presenter;

import android.content.Context;

import cn.yuan.xiaoyu.commonmodule.manager.HttpManager;
import cn.yuan.xiaoyu.commonmodule.net.ResponseListener;
import cn.yuan.xiaoyu.newsmodule.bean.TouTiaolistBean;

/**
 * Created by yukuoyuan on 2017/3/7.
 * 新闻列表的逻辑层
 */
public class NewsHomeListPresenter {
    INewsHomeListVIew iNewsHomeListVIew;
    Context context;

    public NewsHomeListPresenter(INewsHomeListVIew iNewsHomeListVIew, Context context) {
        this.iNewsHomeListVIew = iNewsHomeListVIew;
        this.context = context;
    }

    /**
     * 获取列表的数据
     *
     * @param query 请求的参数
     */
    public void getListData(String query) {
        HttpManager.getInstance().getNewsList(query, new ResponseListener<TouTiaolistBean>() {
            @Override
            public void onSuccess(TouTiaolistBean touTiaolistBean) {
                iNewsHomeListVIew.setAdapterData(touTiaolistBean);
              //  iNewsHomeListVIew.showT("成功了" + touTiaolistBean.data.size());
            }

            @Override
            public void onFailure(String responseresult) {
                iNewsHomeListVIew.showT("成功了");
            }
        });
    }
}
